<#assign contextPath=springMacroRequestContext.getContextPath() />
<#assign name=names />

<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-商品规格管理"> </@frame.head>

<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span> 账号管理 <span
		class="c-gray en">&gt;</span> 老师账号 <a class="btn btn-success radius r"
		style="line-height:1.6em;margin-top:3px"
		href="javascript:location.replace(location.href);" title="刷新"><i
		class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
<form method="post" name="query_product_form" id="query_product_form"
		action="${contextPath}/teach/teachlist">    
   <input type="hidden" name="page" value="${pagination.pageNo}"
			id="page" />  
   <input type="hidden" name="checkboxs" value="${checkboxs}"
			id="checkboxs" />
   <input type="hidden" name="upOrDown" value="${upOrDown}"
			id="upOrDown" />                           
    <div class="text-c">
        <table class="table search_table">
           <tr>  
	           <!--  用户名：<input class="input-text" value="${teachersQo.name}"
						style="width:250px" name="name" type="text" placeholder=" 请输入用户名">手机号：<input
						class="input-text" style="width:250px"
						value="${teachersQo.phoneNumber}" type="text" name="phoneNumber"
						placeholder=" 请输入手机号"> -->
						用户名:&nbsp;&nbsp;<input type="text" class="input-text" style="width:250px" placeholder="输入用户名" id="" value="${teachersQo.name}" name="name">&nbsp;&nbsp;手机号:&nbsp;&nbsp;<input type="text" class="input-text" style="width:250px" placeholder="输入手机号" value="${teachersQo.phoneNumber}" id="" name="phoneNumber">
		&nbsp;&nbsp;<button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>
						
          </tr>
			<tr>
					<!-- <td colspan="6" style="text-align:center;">
           <input class="btn btn-success radius" type="submit"
						value="搜索" />
             </td> -->

      
			</table>
    </div>
</form>

    <div class="cl pd-5 bg-1 bk-gray mt-20"> 
    <span class="l">
    <a href="javascript:;"  onclick="addTeacher()" type="button"
			class="btn btn-primary radius"> 添加账号</a> 
    </span>
    <span class="r">共有数据：<strong>${pagination.totalCount}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-bg">
   	
        <thead>
        <tr class="text-c">
            <th>序号</th>
            <th>用户名</th>
            <th>手机号</th>
            <th>所属专业</th>
            <th>身份</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
       
         <#list pagination.list as list> 
          	<tr class="text-c">
            <td>${(pagination.pageNo-1)*10 + list_index+1}</td>
            <td>
					 ${list.name}
           </td>
            <td>       
					 ${list.phoneNumber}
				</td>
            <td>   
					<#if list.theirprofession==1>	
						美术
					</#if>
					<#if list.theirprofession==2>	
						舞蹈
					</#if>
				</td>
            <td>老师</td>
            <td>
            <a href="javascript:;" type="button"
						onclick="czmmrole(${list.id?c});">重置密码/</a>&nbsp;&nbsp;&nbsp;
					
					 <a href="${contextPath}/teach/teacherView?id=${list.id}"
						type="button">查看/</a>&nbsp;&nbsp;&nbsp;
            
            <a href="javascript:;" type="button"
						onclick="delrole(${list.id?c});">删除</a>&nbsp;&nbsp;&nbsp;
           
            </td>
         </tr>
         
         <!-- ${(list.createDate?string("yyyy-MM-dd"))!} -->
         </#list>
        </tbody>
    </table>
    <div id="div_page" style="padding-top: 10px;float: right"></div>
</div>
<@frame.end "default">
</@frame.end>
</html>
<script type="text/javascript"
	src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript"
	src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript">
var path="${contextPath}";
function delrole(id){
	layer.confirm("确定删除此角色吗?",function(){
		layer.closeAll('dialog');
		var layer_load_window = layer.load(2); 
		  $.ajax({
				url : path+"/teach/teacherDel",
				cache : false,
				type : 'post',
				dataType : 'html',
				data : {
					"id":id},
				error : function() {
					layer.alert("操作失败!");
				},
				success : function(message) {
	        		if(message == "200"){
	                    layer.msg('操作成功!',{icon:1,time:1000},function(){
	                        window.location.reload();
	                    });
	 				}else if(message == "500"){
	 					layer.alert("系统繁忙！");
	 				}else{
	 					layer.alert(message);
	 				}
				},complete: function(XMLHttpRequest, textStatus) {
					layer.close(layer_load_window);
				}
		  });
	});
} 

 laypage({
	cont: 'div_page',//容器。值支持id名、原生dom对象，jquery对象。
    pages: ${pagination.totalPage},//通过后台拿到的总页数
    curr:  ${pagination.pageNo} || 1, //当前页
    skip: true, //是否开启跳页
	first: 1, //将首页显示为数字1,。若不显示，设置false即可
    last: ${pagination.totalPage},
    jump: function(obj , first){//触发分页后的回调
        if(!first){ //点击跳页触发函数;当前页为obj.curr
        	window.location.href = path + "/teach/teachlist?page=" + obj.curr
        }
    }
})  

/* function editroles(id){
	  var url=path+"/teach/teacheruppwd?id="+id;
	  if(url!=""){
	      var index = layer.open({
	            type: 2,
	            title: "修改密码",
	            scrollbar: false,
	            content: url,
	            area: ['500px', '400px']
	        });
	    }
} */

function addTeacher(){
	  var url=path+"/teach/teachertzadd"
	  if(url!=""){
	      var index = layer.open({
	            type: 2,
	            title: '添加账号',
	            scrollbar: false,
	            content: url,
	            area: ['680px', '580px']
	        });
	    }
}


 function czmmrole(id){
	var name="${names}";
	layer.confirm("此操作会将"+name+"密码重置为123456,请确认操作。",function(){
		layer.closeAll('dialog');
		var layer_load_window = layer.load(2); 
		  $.ajax({
				url : path+"/teach/teacherCzMima",
				cache : false,
				type : 'post',
				dataType : 'html',
				data : {
					"id":id},
				error : function() {
					layer.alert("操作失败!");
				},
				success : function(message) {
	        		if(message == "200"){
	                    layer.msg('操作成功!',{icon:1,time:1000},function(){
	                        window.location.reload();
	                    });
	 				}else if(message == "500"){
	 					layer.alert("系统繁忙！");
	 				}else{
	 					layer.alert(message);
	 				}
				},complete: function(XMLHttpRequest, textStatus) {
					layer.close(layer_load_window);
				}
		  });
	});
}
</script>